package com.awspaas.user.apps.processforsap.event;

import com.actionsoft.bpms.bpmn.engine.core.delegate.ProcessExecutionContext;
import com.actionsoft.bpms.bpmn.engine.listener.ExecuteListener;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;

import java.util.List;

public class SD012AfterSave extends ExecuteListener {
    @Override
    public void execute(ProcessExecutionContext ctx) throws Exception {
        String bindid = ctx.getProcessInstance().getId();
        String sql = "select * from BO_EU_SAPSD_DZDJ_01 where ((INFLUENCEMONEY>4.99 and CURRENCY='CNY') " +
                "				or (INFLUENCEMONEY>0.699 and CURRENCY='USD')) and bindid=?";
        List<RowMap> maps = DBSql.getMaps(sql, new Object[]{bindid});
        if (maps.size() > 0) {
            SDK.getProcessAPI().setVariable(bindid, "JudePrice", "1");
        } else {
            SDK.getProcessAPI().setVariable(bindid, "JudePrice", "0");
        }

    }
}